/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
 * Nihongo
 * Copyright (C) Massimiliano Maniscalco 2011, 2012 <massi.neptune@yahoo.com>
 * 
Nihongo is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Nihongo is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _TESTSCELTAMULTKANJI_H_
#define _TESTSCELTAMULTKANJI_H_

#include "test_scelta_mult.h"
#include "kanji.h"
#include "result_test_kanji.h"

#define MOD_KANJI_MEMORY	0
#define MOD_KANJI_READING   1
#define KNJ_SIGN	false

class TestSceltaMultKanji: public TestSceltaMult 
{
public:
	inline TestSceltaMultKanji ( Glib::RefPtr<Gtk::Builder> _bldr, list<Kanji> *sel, list<Kanji> *all );
	inline ~TestSceltaMultKanji ();
	void run_test ( char *options );

protected:
	void update_window ( void );
	void possibili_risposte ( Glib::ustring &risp1, Glib::ustring &risp2, Glib::ustring &risp3, Glib::ustring &risp4 );
	const Kanji* prendi_kanji_casuale ( void );
	Glib::ustring crea_etichetta ( const Kanji &knj );
	void on_risposta ( char tasto = -1 );
	void next_question ( void );
	bool show_result ( void );

private:
	list<Kanji> *_contenuto;
	list<Kanji> *_tutti;
	list<Kanji>::iterator _kanjiCorrente;
	ResultTestKanji *_resultCtrl;

};

inline TestSceltaMultKanji::
TestSceltaMultKanji ( Glib::RefPtr<Gtk::Builder> _bldr, list<Kanji> *sel, list<Kanji> *all )
: _contenuto ( sel ), _tutti ( all ), _kanjiCorrente ( sel->begin() ), _resultCtrl ( new ResultTestKanji ( _bldr, sel ) )
{
	init_test_scelta_mult ( _bldr );
	connect_signals ();
	_resultCtrlConnection = _resultCtrl->signal_window_closed ().connect (sigc::mem_fun (this, &TestSceltaMultKanji::on_result_window_closed) );
}

inline TestSceltaMultKanji::
~TestSceltaMultKanji ()
{
	delete _contenuto;
	delete _resultCtrl;
}

#endif // _TESTSCELTAMULTKANJI_H_
